﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CaseReivew.Model;
using CaseReview.Model;

namespace CaseReview.SQLServerDAL
{
    public class BusinessLogic {
        private static BusinessLogic instatnce = null;
        private static Case _case = null;
        private static ReviewResult _result = null;

        private BusinessLogic() {
            _case = new Case();
            _result = new ReviewResult();
        }

        public static BusinessLogic GetInstance() {
            if(instatnce == null)
                instatnce = new BusinessLogic();
            return instatnce;
        }

        public void InsertReviewResults(ReviewResultInfo resultInfo)
        {
            _result.Insert(resultInfo);
        }

        public IList<CaseInfo> GetTotalCaseByStatus(int status) {
            return _case.GetTotalCaseByStatus(status);
        }

        public IList<ReviewResultInfo> GetTotalResultsByStatus(int status) {
            return _result.GetTotalResultsByStatus(status);
        }

        public IList<CaseInfo> GetTotalCaseByReviewer(int reviewer) {
            return _case.GetTotalCaseByReviewer(reviewer);
        }

        public void InsertCase(CaseInfo caseInfo) {
            _case.Insert(caseInfo);
        }

        public  CaseInfo GetCaseInfoByCaseId(string caseId)
        {
            return _case.GetCaseInfo(caseId);
        }
        public void UpdateCase(CaseInfo caseInfo,string oldCaseId) {
            _case.UpdateCase(caseInfo,oldCaseId);
        }
        public void UpdateResult(ReviewResultInfo resultInfo,string oldCaseId) {
            _result.UpdateResult(resultInfo,oldCaseId);
        }
    }
}
